package com.facebookproject;



import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

public class MPagerAdapter extends FragmentPagerAdapter{
	protected static final String[] CONTENT = new String[] {
		"Me", "My Friends", "Location"	
	};
	
	private int mCount = CONTENT.length;

	public MPagerAdapter(FragmentManager fm) {
		super(fm);
	}

	

	@Override
	public Fragment getItem(int position) {
		Fragment fragment = new FragmentMe();
		switch(position){
		case 0:
			fragment = new FragmentMe();
			break;
		case 1:
			fragment = new FragmentFriends();
			break;
		case 2:
			fragment = new FragmentLocation();
			break;
		}
		return fragment;
	}

	@Override
	public int getCount() {
		return mCount;
	}
	
	@Override
	public CharSequence getPageTitle(int position){
		String title = "";
		switch(position){
		case 0:
			title = "ME";
			break;
		case 1:
			title = "FRIENDS";
			break;
		case 2:
			title = "LOCATION";
			break;
		}
		
		return title;
	}
	
	public void setCount(int count){
		if (count > 0 && count < 10){
			mCount = count;
			notifyDataSetChanged();
		}
	}
	
}